<template>
  <div id="app">
    <router-view  v-if="isRouterAlive"/>
  </div>
</template>

<script>
	import {
		mapState,
		mapMutations
	} from 'vuex';
	
  export default {
    name: 'App',
	provide(){
		return{
			reload:this.reload
		}
	},
	data(){
		return{
			isRouterAlive:true
		}
	},
	created(){
		this.bodyScale()
		this.getClassify()
	} ,
	methods:{
		bodyScale() {
		      var devicewidth = document.documentElement.clientWidth; //获取当前分辨率下的可视区域宽度
		      var scale = devicewidth / 1920; // 除以设计稿的尺寸
		      document.body.style.zoom = scale; // 放大缩小相应倍数
		    },
		...mapMutations(['ADD_CLASSIFY']),
		getClassify(){
			this.axios.post("/api/index/findMallClassify", {
			}).then(res => {
				this.ADD_CLASSIFY(res.data)
			}).catch(error => {
			})
		},
		reload(){
			this.isRouterAlive=false,
			this.$nextTick(function(){
				this.isRouterAlive=true;
			})
		}
	}
  }
</script>

<style>
  @import url('./assets/css/common.css');

  * {
    padding: 0;
    margin: 0;
  }

  html,
  body {
    margin: 0;
    padding: 0;
    height: 100%;
	
  }

  #app {
    font-family: "Avenir", Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    height: 100%;
    width: 100%;
    min-width: 1300px;
  }

  .box {
    height: 100%;
  }

 
 a {
   text-decoration: none;
 }
  
 .router-link-active {
   text-decoration: none;
 }
</style>
